package com.kbckbc.emailmemo;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MemoDBHelper extends SQLiteOpenHelper {
	public MemoDBHelper(Context context) {
		super(context, Query.dbFileName, null, 9);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(Query.createMemoDB);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		//
		if (newVersion > oldVersion) {
			L.v(this, "onUpgrade()");

			try {
				L.v(this, "Query.addTagColumn " + Query.addTagColumn);
				db.execSQL(Query.addTagColumn);
			} catch (Exception e) {
				e.printStackTrace();
			}

			try {
				L.v(this, "Query.addImageColumn" + Query.addImageColumn);
				db.execSQL(Query.addImageColumn);
			} catch (Exception e) {
				e.printStackTrace();
			}

			try {
				L.v(this, "Query.addSyncColumn" + Query.addSyncColumn);
				db.execSQL(Query.addSyncColumn);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
